﻿@using WeBlog.Models
@model WeBlog.Models.BlogPostModel

@{
    ViewBag.Title = "Details";
}
@using (Html.BeginForm())
{
<h2>Details</h2>

<div>
    <h4>Post</h4>
    <hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.BlogPost.Title)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.BlogPost.Title)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.BlogPost.BlogDateTime)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.BlogPost.BlogDateTime,"{0:F}")
        </dd>
        <br/>
        <dt>
            @Html.DisplayNameFor(model => model.BlogPost.Body)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.BlogPost.Body)
        </dd>
        <br/>
        <dt>
            @Html.DisplayNameFor(model => model.BlogPost.ExternalLink)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.BlogPost.ExternalLink)
        </dd>

    </dl>
</div>


        <dl class="dl-horizontal">
            <h4>Comments</h4>
            <hr/>
        @foreach(BlogPostComment comment in Model.Comments)
        {
        
                <dt>
                    @Html.DisplayNameFor(modelItem => comment.Body)
                 </dt>

                <dd>
                    @Html.DisplayFor(modelItem => comment.Name) &nbsp;&nbsp; @Html.DisplayFor(modelItem => comment.BlogDateTime,"ShortDateTime")
                </dd>
                
                
                <dt>
                    
                 </dt>

                 <dd>
                @Html.DisplayFor(modelItem => comment.Body)
                </dd>

       
        }
        </dl>



    @Html.AntiForgeryToken()
    
         <div class="form-horizontal">
             <h4>New Comment</h4>
             <hr />
             @Html.ValidationSummary(true, "", new {@class = "text-danger"})
             
             <input type="hidden" name="blogPostId" id="blogPostId" value="@Model.BlogPost.Id" />

            <div class="form-group">
                     @Html.LabelFor(model => model.NewComment.Name, htmlAttributes: new {@class = "control-label col-md-2"})
                    <div class="col-md-10">
                     @Html.EditorFor(model => model.NewComment.Name, new {htmlAttributes = new {@class = "form-control"}})
                     @Html.ValidationMessageFor(model => model.NewComment.Name, "", new {@class = "text-danger"})
                 </div>
             </div>
            
            <div class="form-group">
                     @Html.LabelFor(model => model.NewComment.Body, htmlAttributes: new {@class = "control-label col-md-2"})
                    <div class="col-md-10">
                     @Html.EditorFor(model => model.NewComment.Body, new {htmlAttributes = new {@class = "form-control"}})
                     @Html.ValidationMessageFor(model => model.NewComment.Body, "", new {@class = "text-danger"})
                 </div>
             </div>

             <div class="form-group">
                 <div class="col-md-offset-2 col-md-10">
                     <input type="submit" value="Create" class="btn btn-default" />
                 </div>
             </div>
         </div>
     
}
   

<div>
    @Html.ActionLink("Back to List", "Index", "Home")
</div>
